package com.example.healkep;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import com.example.healkep.adapter.bg.InputFragmentAdapter;
import com.example.healkep.fragment.bg.FragmentInputAB1;
import com.example.healkep.fragment.bg.FragmentInputAB2;
import com.example.healkep.fragment.bg.FragmentInputAD1;
import com.example.healkep.fragment.bg.FragmentInputAD2;
import com.example.healkep.fragment.bg.FragmentInputAL1;
import com.example.healkep.fragment.bg.FragmentInputAL2;
import com.example.healkep.fragment.bg.FragmentInputBB;
import com.example.healkep.fragment.bg.FragmentInputBD;
import com.example.healkep.fragment.bg.FragmentInputBL;
import com.example.healkep.fragment.bg.FragmentInputBS;

import java.util.ArrayList;

import cn.youngkaaa.yviewpager.YViewPager;
import q.rorbin.verticaltablayout.VerticalTabLayout;

public class ChooseInputBg extends AppCompatActivity {

    private VerticalTabLayout tabLayout;
    private YViewPager viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.choose_input_bg);

        tabLayout = findViewById(R.id.tab_layout);
        viewPager = findViewById(R.id.view_pager);

        final ArrayList<String> tabName = new ArrayList<>();
        tabName.add("空腹");
        tabName.add(" 早餐后     1小时");
        tabName.add(" 早餐后     2小时");
        tabName.add("午餐前");
        tabName.add(" 午餐后     1小时");
        tabName.add(" 午餐后     2小时");
        tabName.add("晚餐前");
        tabName.add(" 晚餐后     1小时");
        tabName.add(" 晚餐后     2小时");
        tabName.add("睡前");


        final ArrayList<Fragment> fragmentList = new ArrayList<>();
        fragmentList.add(new FragmentInputBB());
        fragmentList.add(new FragmentInputAB1());
        fragmentList.add(new FragmentInputAB2());
        fragmentList.add(new FragmentInputBL());
        fragmentList.add(new FragmentInputAL1());
        fragmentList.add(new FragmentInputAL2());
        fragmentList.add(new FragmentInputBD());
        fragmentList.add(new FragmentInputAD1());
        fragmentList.add(new FragmentInputAD2());
        fragmentList.add(new FragmentInputBS());

        InputFragmentAdapter inputFragmentAdapter = new InputFragmentAdapter(getSupportFragmentManager(), fragmentList,
                tabName);
        viewPager.setAdapter(inputFragmentAdapter);

        tabLayout.setupWithViewPager(viewPager);

    }
}


